package com.leyou.search.utils;

import java.util.Map;

public class SearchRequest {

    private String key;//搜素关键字
    private Integer page;//当前页
    private Map<String, String> filter;//
    private static final Integer DEFAULT_PAGE = 1;//缺省第几页
    private static final Integer DEFAULT_SIZE = 20;//默认显示条数

    public Map<String, String> getFilter() {
        return filter;
    }

    public void setFilter(Map<String, String> filter) {
        this.filter = filter;
    }

    public Integer getSize() {
        return DEFAULT_SIZE;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public Integer getPage() {
        if (page == null) {
            return DEFAULT_PAGE;
        }
        return Math.max(page, DEFAULT_PAGE);//
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public static Integer getDefaultPage() {
        return DEFAULT_PAGE;
    }

    public static Integer getDefaultSize() {
        return DEFAULT_SIZE;
    }
}
